 $(document).ready(function($)
{
  //$.sankofavVolunteer.loadVolunteer()
  // trigger event when button is clicked
  $("#addbutton").click(function()
  {
    // add new row to table using addTableRow function
    addTableRow($("#input_table"));
 
    // prevent button redirecting to new page
    return false;
  });

});

var back = function() {
    window.location="window.history.back()";
}

var mouseover = function(){
    onMouseover="Take you to this page";
}


var count = 1;


// function to add a new row to a table by cloning the last row and
  // incrementing the name and id values by 1 to make them unique
  var addTableRow = function(table)
  {

    // clone the last row in the table
    var $tr = $('#input_table').find("tbody tr:last").clone();
    $tr.find("input").attr("value","");
 
    // get the name attribute for the input and select fields
    $tr.find("input,select").attr("name", function()
    {
      // break the field name and it's number into two parts
      var parts = this.id.match(/(\D+)(\d+)$/);
 
      // create a unique name for the new field by incrementing
      // the number for the previous field by 1
      return parts[1] + ++parts[2];
    // repeat for id attributes
    });

     $tr.find("input,select").attr("id", function()
     {
       var parts = this.id.match(/(\D+)(\d+)$/);
       return parts[1] + ++parts[2];
     });
         
    // append the new row to the table
    $(table).find("tbody tr:last").after($tr);

    count++;


  };


var saveinfo = function(){
        
        for(i=1;i<=count;i++)
          {sankofaVolunteer.addVolunteers(i)};
        console.log("clickedsubmit"+i);
        // location.href='/aperture-sankofa/html/volunteer.html';
        setTimeout(location.href='/aperture-sankofa/html/volunteer.html',50);
      };


var takemetoinfo = function(i){
    
    window.location.href = '/aperture-sankofa/html/volunteerinfo.html?id=' + (i-1);
    console.log("row");
    // sankofaVolunteerinfo.loadVolunteerinfo(i);

};

var takemetoeventinfo = function(i){
    
    window.location.href = '/aperture-sankofa/html/eventinfo.html?id=' + i;
    console.log("row");
    // sankofaVolunteerinfo.loadVolunteerinfo(i);

};



// $(".a_volunteer_row").click(function(){console.log("row")});
    //function(){console.log($('.a_volunteer_row').attr("id"))}
   //window.location.href = '/aperture-sankofa/html/volunteerinfo.html';
   //console.log($('.a_volunteer_row').attr("id"));
